<?php
//error_reporting(E_ALL);
//ini_set('display_errors', '1');
session_start();
include_once('config/db_conn.php');
include_once('db_config/db_user.php');
include_once('db_config/db_websetting.php');

if($_SESSION['user_id'] == '')
	reDirect('index.php');

$websetting= new websetting();
$websetting_id = '1';
$rs_websetting=$websetting->uniq_websettings('websetting_id',$websetting_id);
$data_websetting=mysql_fetch_array($rs_websetting);

$user=new user();
$rs_user=$user->uniq_user_list('user_id',$_SESSION['user_id']);
$data_user=mysql_fetch_array($rs_user);

if(@$_REQUEST['submit'])
{

	$user_data['user_fullname']= $_REQUEST['user_fullname'];
	$user_data['user_primary_email']= $_REQUEST['user_primary_email'];
	$user_data['user_paypal_account_email']= $_REQUEST['user_paypal_account_email'];
	$user_data['user_desc']=  htmlspecialchars($_REQUEST['user_desc'],ENT_QUOTES);
	if($_FILES['user_image']['name']!='')
	{
	$user_data['user_image']= date("ymdhi").$_FILES['user_image']['name'];
	}
	$fldArray['user_id']=$_SESSION['user_id'];
	$rs_user=$user->dataUpdate('ninerr_user',$user_data,$fldArray);

	$fileName=$_FILES['user_image']['name'];
	$fileSize='2000';
	$fileTempName=$_FILES['user_image']['tmp_name'];
	$folderPath='userimg';
	$oldfileName='';
	fileUpload($fileName,$oldfileName,$fileSize,$fileTempName,$folderPath,$maxSize=5242880);
	reDirect('profile_edit.php');
}


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $data_websetting['change_title']; ?></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="css/custom.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="javascript/jquery.min.js"></script>
<script type="text/javascript" src="javascript/jquery.simplemodal.js"></script>
<script type="text/javascript" src="javascript/init.js"></script>
<script type="text/javascript" src="javascript/init1.js"></script>

</head>
<body>
<div id="container" class="content">

<!--HEADER AREA-->
<?php include('header.php')?>
<!--HEADER AREA END-->
<div id="main" class="clearfix">
	<div class="main-tl">
	  	<div class="main-tr"></div>
	  	<div class="main-top"></div>
	</div>
	<div class="main-inner clearfix">
		<div class="side1">
		<!-- side1 content BEGIN ======================================================= -->
		<div class="userProfiles form">
			<h2>Settings</h2>
			<p class="user-profile-info">leemtowshen, your public profile page is here:  
				<a title="leemtowshen" target="_blank" href="#">http://www.eskoosh.com link to user page</a>						
			</p>
			<div class="clearfix">
				<div class="cancel-block active"><a title="Settings" href="profile_edit.php">Settings</a></div>
				<div class="cancel-block "><a title="Change password" href="change_password.php">Change Password</a></div>
			</div>
		    <div class="user-edit-form-block">
				<form class="normal" method="post" id="edit_user" enctype="multipart/form-data" action="">	
					<div class="input text">
						<label>Full Name</label>
						<input type="text" id="profile_name" value="<?php echo $data_user['user_fullname']; ?>"  name="user_fullname"  maxlength="100" />
					</div>
					<div class="input text">
						<label>Email</label>
						<input type="text" id="user_email" value="<?php echo $data_user['user_primary_email']; ?>"  name="user_primary_email"  maxlength="100" />
					</div>
					<div class="input text">
						<label>PayPal Account Email</label>
						<input type="text" id="user_paypal_email" value="<?php echo $data_user['user_paypal_account_email']; ?>" maxlength="255" name="user_paypal_account_email" />
					</div>
					<div class="input textarea">
						<label>About Me</label>
						<textarea id="" name="user_desc" rows="6" cols="30"><?php echo $data_user['user_desc']; ?></textarea>
					</div>
					<div class="input file">
						<label>Upload Photo</label>
						<input type="file" value="" class="browse-field" size="33" name="user_image" />
					</div>		
					<div class="profile-image">
		            	<a href="#"><img height="76" width="106" title="leemtowshen" alt="[Image: leemtowshen]" class="" src="userimg/<?php echo $data_user['user_image']; ?>" /></a>		
					</div>
					<div class="submit-block clearfix">
						<div class="submit"><input type="submit" value="Update" name="submit" /></div>
					</div>
				</form>
			</div><!-- end user-edit-form-block -->
		</div><!-- end userProfiles -->
		<!-- side1 content END ============================================================ -->
		</div><!-- end side1 -->
		<!-- side2 BEGIN ====================== -->
		<?php include('right.php'); ?>
		<!-- side2 END ====================== -->
	</div><!-- end main-inner-->
</div><!-- end main -->
<!--FOOTER AREA-->
<?php include('footer.php');?>
 <!--FOOTER AREA END-->

</div><!-- end container -->
</body>
</html>
